		function GetRequest() {   
			   var url = location.search; //获取url中"?"符后的字串   
			   var theRequest = new Object();   
			   if (url.indexOf("?") != -1) {   
			      var str = url.substr(1);   
			      strs = str.split("&");   
			      for(var i = 0; i < strs.length; i ++) {   
			         theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);   
			      }   
  			 }   
   			return theRequest;   
		} 
		
		layui.use(['upload','element','table','form','laytpl'],function(){ 
			var $ = layui.jquery ,
			upload = layui.upload ,
			table = layui.table ,
			layer = layui.layer ,
			element =layui.element ,
			form = layui.form ,
			laytpl=layui.laytpl
			paperListTpt = paperList.innerHTML;
			
			
			$.ajax({
				type: "get",
				url: "http://localhost:8888/paper/getPaperListOfStudentNo",
				data:{"studentNo":GetRequest().studentNo},
				success: function(data) {
					laytpl(paperListTpt).render(data, function(html) {
						$("#view3").html(html)
						form.render()
					})
				}
			})
			
			form.on('select(paperList)',function(data){
				$("#paperIdHidden").val(data.value)
			})
			
			$("#submitRequest").click(function() {
				if($("#paperIdHidden").val() != "") {
					$.ajax({
						type: "post",
						url: "http://localhost:8888/studentPaper/requestForExam",
						data: {
							'studentNo': GetRequest().studentNo,
							'paperId': $("#paperIdHidden").val()
						},
						success: function(data) {
							if(data.code == 0) {
								layer.msg("预约成功!")
								form.render()
								element.render()
								$.ajax({
									type: "get",
									url: "http://localhost:8888/paper/getPaperListOfStudentNo",
									data: {
										"studentNo": GetRequest().studentNo
									},
									success: function(data) {
										laytpl(paperListTpt).render(data, function(html) {
											$("#view3").html(html)
											form.render()
										})
									}
								})
							} else {
								layer.msg("您已经预约此次考试了,请勿重复预约")
							}
			
						},
						error: function() {
							layer.msg("您已经预约成功了,请勿重复预约")
						}
					})
				}
			
			})
			
		});